package com.etennis.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.etennis.mapper.view.ClubStatMapper;
import com.etennis.pojos.ResponseResult;
import com.etennis.pojos.view.ClubStats;
import com.etennis.pojos.vo.app.ClubVO;
import com.etennis.service.IClubService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/app/club")
@Slf4j
@Api(tags = "用户端-俱乐部接口")
public class ClubController {
//    @Autowired
//    private ClubStatMapper clubStatMapper;
//    @Autowired
//    private IClubService clubService;
//    @GetMapping("/rank")
//    @ApiOperation("俱乐部活跃度排名")
//    public ResponseResult<List<ClubVO>> club(){
//        LambdaQueryWrapper<ClubStats> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.orderByDesc(ClubStats::getHeat);
//        List<ClubStats> clubStatsList = clubStatMapper.selectList(queryWrapper);
//        List<ClubVO> clubVOList=clubStatsList.stream().map(clubStats -> new ClubVO(clubStats.getId(),clubService.getById(clubStats.getId()).getName(),clubService.getById(clubStats.getId()).getIcon(),clubStats.getHeat())).collect(Collectors.toList());
//        return ResponseResult.okResult(clubVOList);
//    }

}
